<?php
require_once "checklogin.php";
require_once "../lib/MySQLDB.class.php";
$db=MySQLDB::getInstance();
$data["id"]=$_GET["id"];
$sql="select cName from category where pid=?";
$rows=$db->fetchAll($sql,"i",$data);
if(empty($rows))
{
    $sql="delete from category where id=?";
    $res=$db->query($sql,"i",$data);
    if($res){
        layerAlert("类别删除成功！",1,"catelist.php");
    }else{
        layerAlert("类别删除失败！",5,"catelist.php");
    }
}else{
    layerAlert("请先删除当前栏目的子栏目后再进行删除操作！",5,"catelist.php");
}